import request from '@/utils/request'

export function getList(params) {
  return request({
    url: '/vue-admin-template/table/list',
    method: 'get',
    params
  })
}

export function useTableApi(id) {
  return request({
    url: '/maku-generator/gen/table/' + id,
    method: 'get'
  })
}

export function useFieldTypeListApi() {
  return request.get('/maku-generator/gen/fieldtype/list')
}

export function useTableFieldSubmitApi(id, data) {
  return request({
    url: '/maku-generator/gen/table/field/' + id,
    method: 'put',
    data
  })
}

export const useTableImportSubmitApi = (datasourceId, tableNameList) => {
  return request.post('/maku-generator/gen/table/import/' + datasourceId, tableNameList)
}

export const useTableSyncApi = (id) => {
  return request.post('/maku-generator/gen/table/sync/' + id)
}

export const useTableSubmitApi = (dataForm) => {
  return request.put('/maku-generator/gen/table', dataForm)
}
